#pragma once

using namespace System;
using namespace System::Collections::Generic;

#include "NBTTagListWrapper.h"

public ref class NBTTagWrapper
{
	NBTTag *_tag;

public:
	NBTTagWrapper(NBTTag *tag) :
		_tag(tag)
	{
	}

	NBTTagWrapper ^Find(System::String ^str)
	{
		std::string asString;
		asString.reserve(str->Length);

		for (int i = 0; i < str->Length; ++i)
			asString += str[i];

		return gcnew NBTTagWrapper(_tag->Find(asString));
	}

	Int16 GetInt16()
	{
		return _tag->GetValue<short>();
	}

	List<byte> ^GetByteArray()
	{
		auto list = _tag->GetByteArray();
		List<byte> ^gclist = gcnew List<byte>();

		for (auto it = list.begin(); it != list.end(); ++it)
			gclist->Add(*it);

		return gclist;
	}

	NBTTagListWrapper ^GetList()
	{
		return gcnew NBTTagListWrapper(&_tag->GetList());
	}
};